Imports Clo = Enhancements.Core.Logging
Imports Ref = System.Reflection
Imports Sys = System

Namespace Enhancements.Basic
    ''' <summary>The exception that is thrown when a value is of a type that implements a certain interface.</summary>
    <Serializable(), DebuggerStepThrough()> _
    Public NotInheritable Class IsImplementationOfException
        Inherits AssertException

        Private Sub New(ByVal _objectName As System.String, ByVal _object As Sys.Object, ByVal _interfaceType As Sys.Type)
            MyBase.New(_objectName)
            [Object] = _object
            InterfaceType = _interfaceType
        End Sub

        Private __Object As System.Object = Nothing
        ''' <summary>Gets the value of the object that caused this exception.</summary>
        Public Property [Object]() As System.Object
            Get
                Return __Object
            End Get
            Private Set(ByVal _value As System.Object)
                __Object = _value
            End Set
        End Property

        Private __InterfaceType As Sys.Type = Nothing
        ''' <summary>Gets the interface type searched.</summary>
        Public Property InterfaceType() As Sys.Type
            Get
                Return __InterfaceType
            End Get
            Private Set(ByVal _value As Sys.Type)
                __InterfaceType = _value
            End Set
        End Property

        ''' <summary>Throws an exception.</summary>
        ''' <param name="_objectName">Name of the object that is causing the exception.</param>
        ''' <param name="_object">Object that is causing the exception.</param>
        ''' <param name="_interfaceType">Interface type searched that is causing the exception.</param>
        ''' <exception cref="IsImplementationOfException"> </exception>
        Friend Shared Sub ___Throw(ByVal _objectName As System.String, ByVal _object As Sys.Object, ByVal _interfaceType As Sys.Type)
            Dim _exception As IsImplementationOfException = New IsImplementationOfException(_objectName, _object, _interfaceType)

            Throw _exception
        End Sub

    End Class
End Namespace
